<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>HTML5游戏 - 见缝插针 | jicemoon</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="相信大家都玩过这个游戏, 这是我为了练习所学的Canvas而写的一个小游戏, 闲话少说, 下面进入整体.
游戏源码下载
首先说明一下文件夹中各个文件的作用: 

index.html ==&amp;gt; 用来测试游戏源码的网页文件;
css/index.css ==&amp;gt; 测试游戏源码的网页样式文件;
js/index.js ==&amp;gt; 测试游戏源码的js文件
js/JicemoonMobileTo">
<meta property="og:type" content="article">
<meta property="og:title" content="HTML5游戏 - 见缝插针">
<meta property="og:url" content="http://jicemoon.github.io/2016/03/11/html5-game-hardestGame/index.html">
<meta property="og:site_name" content="jicemoon">
<meta property="og:description" content="相信大家都玩过这个游戏, 这是我为了练习所学的Canvas而写的一个小游戏, 闲话少说, 下面进入整体.
游戏源码下载
首先说明一下文件夹中各个文件的作用: 

index.html ==&amp;gt; 用来测试游戏源码的网页文件;
css/index.css ==&amp;gt; 测试游戏源码的网页样式文件;
js/index.js ==&amp;gt; 测试游戏源码的js文件
js/JicemoonMobileTo">
<meta property="og:updated_time" content="2016-04-01T13:49:50.242Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="HTML5游戏 - 见缝插针">
<meta name="twitter:description" content="相信大家都玩过这个游戏, 这是我为了练习所学的Canvas而写的一个小游戏, 闲话少说, 下面进入整体.
游戏源码下载
首先说明一下文件夹中各个文件的作用: 

index.html ==&amp;gt; 用来测试游戏源码的网页文件;
css/index.css ==&amp;gt; 测试游戏源码的网页样式文件;
js/index.js ==&amp;gt; 测试游戏源码的js文件
js/JicemoonMobileTo">
  
    <link rel="alternative" href="/atom.xml" title="jicemoon" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
      <link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.5.0/animate.min.css">
  
  
  <link rel="stylesheet" href="/css/style.css">
  
  <link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  
  
    <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  
  <script src="//cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
  <script>
      var yiliaConfig = {
          fancybox: true,
          animate: true,
          isHome: false,
          isPost: true,
          isArchive: false,
          isTag: false,
          isCategory: false,
          open_in_new: false,
      }
  </script>

  
      <script>
          yiliaConfig.rootUrl = "/";
      </script>
  

  
</head>
<body>
  <div id="container">
    <div class="left-col">
    <div class="overlay"></div>
<div class="intrude-less">
    <header id="header" class="inner">
        <a href="/" class="profilepic">
            <img src="/img/avatar.png" class="animated zoomIn">
        </a>
        <hgroup>
          <h1 class="header-author"><a href="/">jicemoon</a></h1>
        </hgroup>

        
        <p class="header-subtitle">人生若只如初见</p>
        
                


        
            <div id="switch-btn" class="switch-btn">
                <div class="icon">
                    <div class="icon-ctn">
                        <div class="icon-wrap icon-house" data-idx="0">
                            <div class="birdhouse"></div>
                            <div class="birdhouse_holes"></div>
                        </div>
                        <div class="icon-wrap icon-ribbon hide" data-idx="1">
                            <div class="ribbon"></div>
                        </div>
                        
                        <div class="icon-wrap icon-link hide" data-idx="2">
                            <div class="loopback_l"></div>
                            <div class="loopback_r"></div>
                        </div>
                        
                        
                        <div class="icon-wrap icon-me hide" data-idx="3">
                            <div class="user"></div>
                            <div class="shoulder"></div>
                        </div>
                        
                    </div>
                    
                </div>
                <div class="tips-box hide">
                    <div class="tips-arrow"></div>
                    <ul class="tips-inner">
                        <li>菜单</li>
                        <li>标签</li>
                        
                        <li>友情链接</li>
                        
                        
                        <li>关于我</li>
                        
                    </ul>
                </div>
            </div>
        

        <div id="switch-area" class="switch-area">
            <div class="switch-wrap">
                <section class="switch-part switch-part1">
                    <nav class="header-menu">
                        <ul>
                        
                            <li><a href="/">主页</a></li>
                        
                            <li><a href="/archives/">所有文章</a></li>
                        
                            <li><a href="/tags/">标签</a></li>
                        
                        </ul>
                    </nav>
                    <nav class="header-nav">
                        <ul class="social">
                            
                                <li id="Email"><a class="Email" target="_blank" href="mailto:jicemoon@outlook.com" title="Email"></a></li>
                            
                                <li id="GitHub"><a class="GitHub" target="_blank" href="https://github.com/jicemoon" title="GitHub"></a></li>
                            
                                <li id="简书"><a class="简书" target="_blank" href="http://www.jianshu.com/users/d3babf0c293b/timeline" title="简书"></a></li>
                            
                        </ul>
                    </nav>
                </section>
                
                
                <section class="switch-part switch-part2">
                    <div class="widget tagcloud" id="js-tagcloud">
                        <a href="/tags/AngularJS/" style="font-size: 15px;">AngularJS</a> <a href="/tags/Array/" style="font-size: 10px;">Array</a> <a href="/tags/CSS/" style="font-size: 10px;">CSS</a> <a href="/tags/Canvas/" style="font-size: 10px;">Canvas</a> <a href="/tags/Docs/" style="font-size: 10px;">Docs</a> <a href="/tags/ECMAScript5/" style="font-size: 10px;">ECMAScript5</a> <a href="/tags/HTML5/" style="font-size: 10px;">HTML5</a> <a href="/tags/Hexo/" style="font-size: 10px;">Hexo</a> <a href="/tags/JavaScript/" style="font-size: 20px;">JavaScript</a> <a href="/tags/Javascript/" style="font-size: 15px;">Javascript</a> <a href="/tags/Web/" style="font-size: 20px;">Web</a> <a href="/tags/ng-repeat/" style="font-size: 15px;">ng-repeat</a> <a href="/tags/位运算符/" style="font-size: 10px;">位运算符</a> <a href="/tags/动态加载/" style="font-size: 10px;">动态加载</a> <a href="/tags/垂直居中/" style="font-size: 10px;">垂直居中</a> <a href="/tags/日期格式化/" style="font-size: 10px;">日期格式化</a> <a href="/tags/见缝插针/" style="font-size: 10px;">见缝插针</a>
                    </div>
                </section>
                
                
                
                <section class="switch-part switch-part3">
                    <div id="js-friends">
                    
                      <a target="_blank" class="main-nav-link switch-friends-link" href="https://hexo.io">Hexo</a>
                    
                      <a target="_blank" class="main-nav-link switch-friends-link" href="https://pages.github.com/">GitHub</a>
                    
                      <a target="_blank" class="main-nav-link switch-friends-link" href="http://moxfive.xyz/">MOxFIVE</a>
                    
                    </div>
                </section>
                

                
                
                <section class="switch-part switch-part4">
                
                    <div id="js-aboutme">专注于前端</div>
                </section>
                
            </div>
        </div>
    </header>                
</div>
    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
      <div class="overlay">
          <div class="slider-trigger"></div>
          <h1 class="header-author js-mobile-header hide"><a href="/" title="回到主页">jicemoon</a></h1>
      </div>
    <div class="intrude-less">
        <header id="header" class="inner">
            <a href="/" class="profilepic">
                <img src="/img/avatar.png" class="animated zoomIn">
            </a>
            <hgroup>
              <h1 class="header-author"><a href="/" title="回到主页">jicemoon</a></h1>
            </hgroup>
            
            <p class="header-subtitle">人生若只如初见</p>
            
            <nav class="header-menu">
                <ul>
                
                    <li><a href="/">主页</a></li>
                
                    <li><a href="/archives/">所有文章</a></li>
                
                    <li><a href="/tags/">标签</a></li>
                
                <div class="clearfix"></div>
                </ul>
            </nav>
            <nav class="header-nav">
                        <ul class="social">
                            
                                <li id="Email"><a class="Email" target="_blank" href="mailto:jicemoon@outlook.com" title="Email"></a></li>
                            
                                <li id="GitHub"><a class="GitHub" target="_blank" href="https://github.com/jicemoon" title="GitHub"></a></li>
                            
                                <li id="简书"><a class="简书" target="_blank" href="http://www.jianshu.com/users/d3babf0c293b/timeline" title="简书"></a></li>
                            
                        </ul>
            </nav>
        </header>                
    </div>
</nav>
      <div class="body-wrap"><article id="post-html5-game-hardestGame" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a href="/2016/03/11/html5-game-hardestGame/" class="article-date">
      <time datetime="2016-03-11T14:07:44.000Z" itemprop="datePublished">2016-03-11</time>
</a>
    </div>
  
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      HTML5游戏 - 见缝插针
    </h1>
  

      </header>
      
      <div class="article-info article-info-post">
        
    <div class="article-category tagcloud">
    <a class="article-category-link" href="/categories/Web/">Web</a>
    </div>


        
    <div class="article-tag tagcloud">
        <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Canvas/">Canvas</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/HTML5/">HTML5</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/见缝插针/">见缝插针</a></li></ul>
    </div>

        <div class="clearfix"></div>
      </div>
      
    
    <div class="article-entry" itemprop="articleBody">
      
          
        <p>相信大家都玩过这个游戏, 这是我为了练习所学的Canvas而写的一个小游戏, 闲话少说, 下面进入整体.</p>
<p><a href="https://github.com/jicemoon/HardestGame" target="_blank" rel="external">游戏源码下载</a></p>
<p>首先说明一下文件夹中各个文件的作用: </p>
<ol>
<li><em>index.html</em> ==&gt; 用来测试游戏源码的网页文件;</li>
<li><em>css/index.css</em> ==&gt; 测试游戏源码的网页样式文件;</li>
<li><em>js/index.js</em> ==&gt; 测试游戏源码的js文件</li>
<li><em>js/JicemoonMobileTouch.js</em> ==&gt; 一个简单的touch兼容库(我自己写的, 有在github分享)</li>
<li><em>js/HardestGame.js</em> ==&gt; 此文件为游戏主要部分, 内含注释</li>
</ol>
<a id="more"></a>
<p>这里面我主要想说的是<em>js/HardestGame.js</em>这个文件</p>
<p>其实这里面都有详细的注释, 首先我想重点说的是<em>extendClass</em>(文件中29-37行)这个函数, 代码如下:<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//判断是否已经定义此方法</span></span><br><span class="line"><span class="keyword">if</span>(!<span class="built_in">window</span>[<span class="string">"extendClass"</span>])&#123;</span><br><span class="line">    <span class="built_in">window</span>[<span class="string">"extendClass"</span>] = <span class="function"><span class="keyword">function</span> (<span class="params">sonClass, parentClass</span>) </span>&#123;</span><br><span class="line">        <span class="comment">//判断所传参数是否为函数对象</span></span><br><span class="line">        <span class="keyword">if</span> (<span class="keyword">typeof</span> parentClass === <span class="string">"function"</span> &amp;&amp; <span class="keyword">typeof</span> sonClass === <span class="string">"function"</span>) &#123;</span><br><span class="line">            <span class="comment">//这一句是继承最主要的部分</span></span><br><span class="line">            sonClass.prototype = <span class="keyword">new</span> ((<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;&#125;).prototype = parentClass.prototype).constructor();</span><br><span class="line">            <span class="comment">//重新定义子类对构造函数为其本身(因为经过上一句的赋值, 子类的构造函数变成了父类的构造函数)</span></span><br><span class="line">            sonClass.prototype.constructor = sonClass;</span><br><span class="line">            <span class="comment">//用super属性记录父类, 以便在子类中引用</span></span><br><span class="line">            sonClass.prototype.super = parentClass;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure></p>
<blockquote>
<p>如果大家想了解<strong>继承</strong>这一部分, 大家可以看一下<a href="http://www.360doc.com/content/15/0731/12/11984479_488530968.shtml" target="_blank" rel="external">这篇文章</a></p>
</blockquote>
<h3 id="基类Circle"><a href="#基类Circle" class="headerlink" title="基类Circle"></a>基类Circle</h3><p>基类Circle里主要定义了一些基本的属性和方法: </p>
<ul>
<li>x/y: 圆形所在的位置;</li>
<li>radius: 圆形的半径;</li>
<li>fillStyle: 圆形的填充颜色(可以设置为css支持的颜色值, 如”#ff0000”,”rgba(240,235,222,0.4)”等, 或者渐变/图片填充, 这一部分请参考canvas - context的fillStyle属性);</li>
<li>strokeStyle: 圆形的描边颜色, 参考上述fillStyle属性;</li>
<li>update: 此方法是为了更新圆形的信息(就是上面的属性)而设置的;</li>
<li>paint: 更新后, 根据上述属性值, 将该对象(这里绘制的是一个圆)重新绘制到画布(即参数context所在的画布–canvas.getContext(“2d”))上;<br>具体的自己看代码就可以了, 不明白的可以给我发邮件</li>
</ul>
<h3 id="中心大圆CircleCenter"><a href="#中心大圆CircleCenter" class="headerlink" title="中心大圆CircleCenter"></a>中心大圆CircleCenter</h3><p>这个是定义的在中心位置的那个大圆, 继承自上述的Circle, 因为这个圆是静止不动的, 并没有做其他的扩充, 也不需要重写update, 这里可以看到在构造函数中, 利用super属性调用了父类的构造函数, 代码如下<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">this</span>.super.call(<span class="keyword">this</span>, ROTATION_CENTER.x,ROTATION_CENTER.y,RADIUS_BIG,fillStyle, strokeStyle);</span><br></pre></td></tr></table></figure></p>
<p>从上述代码可以看出, 只是用开始时定义的变量(静态)固定了位置/大小等属性</p>
<h3 id="跟随旋转的小圆CircleRotation"><a href="#跟随旋转的小圆CircleRotation" class="headerlink" title="跟随旋转的小圆CircleRotation"></a>跟随旋转的小圆CircleRotation</h3><p>这个类也是继承自Circle, 但是做了一些扩展, 扩展的属性和方法:</p>
<ul>
<li>angle: 此小圆当前所在的角度(弧度为单位)</li>
<li>resetPosition: 根据当前的角度(angle), 重新计算此小圆的位置;<br>另外重写了update和paint, update就不必说了, paint并不是完全重写, 只是添加了一部分代码, 其作用是绘制此小圆到中心大圆的一条直线(就是”见缝插针”里的”针”)</li>
</ul>
<h3 id="用来发射的小圆CircleBullet"><a href="#用来发射的小圆CircleBullet" class="headerlink" title="用来发射的小圆CircleBullet"></a>用来发射的小圆CircleBullet</h3><p>即代码注释中所说的子弹, 这个类也继承自Circle, 此类没有做扩展, 只是重写了两个方法, 重写update, 为了实现向上运动的效果; 另外一个paint, 因为子弹上面有子弹编号的文字, 所以在此方法中添加了文字绘制的部分;</p>
<hr>
<p>剩下的代码是游戏控制部分, 也就是Game类</p>
<h3 id="游戏控制类Game"><a href="#游戏控制类Game" class="headerlink" title="游戏控制类Game"></a>游戏控制类Game</h3><p>构造函数就不多说了, 自己看注释, 很详细了<br>主要详细说一下可能用到的属性和方法(注释中没有提到的)</p>
<ul>
<li>centerCircle: 中心位置的圆形, 一个CircleCenter类的对象, 此属性是只读, 外部可以在init初始化后调用修改它的一些属性(位置/颜色等);</li>
<li>rotationCircles: 当前(关卡)跟随旋转的小圆数组, 一个CircleRotation类的对象数组;</li>
<li>bulletCircles: 当前(关卡)未发射的子弹(小圆), 一个CircleBullet类的对象数组;</li>
<li>rotationSpeed: 当前(关卡)大圆旋转的速度;</li>
<li>mobileTouch: JicemoonMobileTouch对象, 用来控制触摸或者鼠标事件的对象;</li>
<li>levelSpaceTime: 关卡之间停留的秒数, 也就是本关卡结束到下一关卡开始之间的时间间隔(在没有设置levelSuccessHandle参数时有效);</li>
<li>init: 初始化游戏;</li>
<li>gameStart: 游戏开始;</li>
<li>gamePause: 暂停游戏;</li>
<li>gameContinue: 游戏暂停后继续, 参数表示是否重新开始本关卡;</li>
<li>gameOver: 游戏结束;</li>
<li>update: 更新游戏内所有对象的位置等信息;</li>
<li>paint: 将游戏内所有对象会知道画布上;</li>
<li>levelChange: 改变关卡, 此方法是在切换关卡是用来重置下一关卡或者本关卡(重玩本关卡时)的数据;</li>
<li>checkCollision: 判断游戏是否成功过关;</li>
<li>tapHandle: 鼠标或触摸后出发的事件监听(在isCanTap为true时, 发射子弹);</li>
<li><strong>levelSuccessHandle: 成功过关后调用的对外接口;</strong></li>
<li><strong>gameOverHandle: 游戏结束后调用的对外接口;</strong></li>
</ul>
<p>介绍就到这里了, 有什么问题可以Email我</p>

      
    </div>
    
  </div>
  
    


    <nav id="article-nav">
        
            <div id="article-nav-newer" class="article-nav-title">
                <a href="/2016/03/14/CSS-middle/">
                    CSS垂直居中
                </a>
            </div>
        
        
    </nav>

  
</article>

    <div id="toc" class="toc-article">
    <strong class="toc-title">文章目录</strong>
    <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#基类Circle"><span class="toc-number">1.</span> <span class="toc-text">基类Circle</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#中心大圆CircleCenter"><span class="toc-number">2.</span> <span class="toc-text">中心大圆CircleCenter</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#跟随旋转的小圆CircleRotation"><span class="toc-number">3.</span> <span class="toc-text">跟随旋转的小圆CircleRotation</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#用来发射的小圆CircleBullet"><span class="toc-number">4.</span> <span class="toc-text">用来发射的小圆CircleBullet</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#游戏控制类Game"><span class="toc-number">5.</span> <span class="toc-text">游戏控制类Game</span></a></li></ol>
</div>
<style>
    .left-col .switch-btn {
        display: none;
    }
    .left-col .switch-area {
        display: none;
    }
</style>

<input type="button" id="tocButton" value="隐藏目录"  title="点击按钮隐藏或者显示文章目录">
<script>
    var valueHide = "隐藏目录";
    var valueShow = "显示目录";

    if ($(".left-col").is(":hidden")) {
        $("#tocButton").attr("value", valueShow);
    }

    $("#tocButton").click(function() {
        if ($("#toc").is(":hidden")) {
            $("#tocButton").attr("value", valueHide);
            $("#toc").slideDown(320);
            $(".switch-btn, .switch-area").fadeOut(300);
        }
        else {
            $("#tocButton").attr("value", valueShow);
            $("#toc").slideUp(350);
            $(".switch-btn, .switch-area").fadeIn(500);
        }
    })

    if ($(".toc").length < 1) {
        $("#toc, #tocButton").hide();
        $(".switch-btn, .switch-area").show();
    }
</script>






    
      <div class="duoshuo" id="comments">
    <!-- 多说评论框 start -->
    <div class="ds-thread" data-thread-key="2016/03/11/html5-game-hardestGame/" data-title="HTML5游戏 - 见缝插针" data-url="http://jicemoon.github.io/2016/03/11/html5-game-hardestGame/"></div>
    <!-- 多说评论框 end -->
    <!-- 多说公共JS代码 start (一个网页只需插入一次) -->
    <script type="text/javascript">
    var duoshuoQuery = {short_name:"jicemoon"};
    (function() {
        var ds = document.createElement('script');
        ds.type = 'text/javascript';ds.async = true;
        ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
        ds.charset = 'UTF-8';
        (document.getElementsByTagName('head')[0] 
         || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
    </script>
    <!-- 多说公共JS代码 end -->
</div>

    




    <div class="scroll" id="post-nav-button">
        
            <a href="/2016/03/14/CSS-middle/" title="上一篇: CSS垂直居中">
                <i class="fa fa-angle-left"></i>
            </a>
        

        <a title="文章列表"><i class="fa fa-bars"></i><i class="fa fa-times"></i></a>

        
            <a href="/" title="回到主页"><i class="fa fa-home"></i></a>
        
    </div>

    <ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/2016/06/09/ng-repeat-finish-render-every-time/">AngularJS中ng-repeat渲染完成事件[2]</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/04/12/ecmascript5-array-method/">ECMAScript 5中的数组方法</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/04/01/AngularJS-repeat-finished/">AngularJS中ng-repeat渲染完成事件[1]和中间变量的引用</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/04/01/Javascript-date-format/">Javascript-date-format</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/03/30/javascriptLoad/">Web动态加载JS外部文件(script标签)</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/03/18/js-bit-operator/">Javascript中的位运算符</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/03/16/HexoDocs/">Hexo Docs基本用法</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/03/14/CSS-middle/">CSS垂直居中</a></li><li class="post-list-item"><a class="post-list-link" href="/2016/03/11/html5-game-hardestGame/">HTML5游戏 - 见缝插针</a></li></ul>
    <script>
        $(".post-list").addClass("toc-article");
        $(".post-list-item a").attr("target","_blank");
        $("#post-nav-button > a:nth-child(2)").click(function() {
            $(".fa-bars, .fa-times").toggle();
            $(".post-list").toggle(300);
            if ($(".toc").length > 0) {
                $("#toc, #tocButton").toggle(200, function() {
                    if ($(".switch-area").is(":visible")) {
                        $("#toc, .switch-btn, .switch-area").toggle();
                        $("#tocButton").attr("value", valueHide);
                        }
                    })
            }
            else {
                $(".switch-btn, .switch-area").fadeToggle(300);
            }
        })
    </script>




    <script>
        
    </script>
</div>
      <footer id="footer">
    <div class="outer">
        <div id="footer-info">
            <div class="footer-left">
                &copy; 2016 jicemoon
            </div>
            <div class="footer-right">
                <a href="http://hexo.io/" target="_blank" title="快速、简洁且高效的静态博客框架">Hexo</a>  Theme <a href="https://github.com/MOxFIVE/hexo-theme-yelee" target="_blank" title="简而不减双栏 Hexo 博客主题">Yelee</a> by MOxFIVE
            </div>
        </div>
        
            <div class="visit">
                
                    <span id="busuanzi_container_site_pv" style='display:none'>
                        <span id="site-visit" >本站到访数: 
                            <span id="busuanzi_value_site_uv"></span>
                        </span>
                    </span>
                
                
                    <span>, </span>
                
                
                    <span id="busuanzi_container_page_pv" style='display:none'>
                        <span id="page-visit">本页阅读量: 
                            <span id="busuanzi_value_page_pv"></span>
                        </span>
                    </span>
                
            </div>
        
    </div>
</footer>
    </div>
    
<script data-main="/js/main.js" src="//cdn.bootcss.com/require.js/2.1.22/require.min.js"></script>

    <script>
        $(document).ready(function() {
            var iPad = window.navigator.userAgent.indexOf('iPad');
            if (iPad > -1 || $(".left-col").css("display") === "none") {
                var bgColorList = ["#9db3f4", "#414141", "#e5a859", "#f5dfc6", "#c084a0", "#847e72", "#cd8390", "#996731"];
                var bgColor = Math.ceil(Math.random() * (bgColorList.length - 1));
                $("body").css({"background-color": bgColorList[bgColor], "background-size": "cover"});
            }
            else {
                var backgroundnum = 5;
                var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
                $("body").css({"background": backgroundimg, "background-attachment": "fixed", "background-size": "cover"});
            }
        })
    </script>




<div class="scroll" id="scroll">
    <a href="#" title="返回顶部"><i class="fa fa-arrow-up"></i></a>
    <a href="#comments" title="查看评论"><i class="fa fa-comments-o"></i></a>
    <a href="#footer" title="转到底部"><i class="fa fa-arrow-down"></i></a>
</div>

<script>
    $(document).ready(function() {
        if ($("#comments").length < 1) {
            $("#scroll > a:nth-child(2)").hide();
        };
    })
</script>


<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>
  </div>
</body>
</html>